package ml.coursedesign.common.util;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson.JSONObject;
import ml.coursedesign.entity.Subject;
import ml.coursedesign.entity.SubjectImportData;
import ml.coursedesign.service.SubjectService;
import org.springframework.beans.factory.annotation.Autowired;

public class SubjectExcelListener extends AnalysisEventListener<SubjectImportData> {

    @Autowired
    SubjectService subjectService;
    @Override
    public void invoke(SubjectImportData subjectImportData, AnalysisContext analysisContext) {
        String courseClassId = "";
        int  selectedNum= 0;
        String groupLeaderId = null;
        Subject subject = new Subject(subjectImportData.getSubjectId(),subjectImportData.getSubjectName(),subjectImportData.getPrimaryNum());
        subjectService.save(subject);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
